import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue')
  },
  {
    path: '/index',
    name: 'index',
    component: () => import(/* webpackChunkName: "index" */ '../views/Index.vue'),
    children: [
      {
        path: 'users',
        name: 'users',
        component: () => import(/* webpackChunkName: "users" */ '../components/User.vue')
      },
      {
        path: 'roles',
        name: 'roles',
        component: () => import(/* webpackChunkName: "roles" */ '../components/rights/Roles.vue')
      },
      {
        path: 'rights',
        name: 'rights',
        component: () => import(/* webpackChunkName: "rights" */ '../components/rights/Rights.vue')
      },
      {
        path: 'goods',
        name: 'goods',
        component: () => import(/* webpackChunkName: "goods" */ '../components/goods/Goods.vue'),
        children: [
          {
            path: '/',
            redirect: '/index/goods/goodslist'
          },
          {
            path: 'goodslist',
            name: 'goodslist',
            component: () => import(/* webpackChunkName: "goods" */ '../components/goods/GoodsList.vue')
          },
          {
            path: 'goodsadd',
            name: 'goodsadd',
            component: () => import(/* webpackChunkName: "goods" */ '../components/goods/GoodsAdd.vue')
          },
          {
            path: 'editgoods/:goods',
            name: 'editgoods',
            component: () => import(/* webpackChunkName: "goods" */ '../components/goods/EditGoods.vue')
          }
        ]
      },
      {
        path: 'params',
        name: 'params',
        component: () => import(/* webpackChunkName: "params" */ '../components/goods/Params.vue')
      },
      {
        path: 'categories',
        name: 'categories',
        component: () => import(/* webpackChunkName: "categories" */ '../components/goods/Categories.vue')
      },
      {
        path: 'orders',
        name: 'orders',
        component: () => import(/* webpackChunkName: "orders" */ '../components/orders/Orders.vue')
      },
      {
        path: 'reports',
        name: 'reports',
        component: () => import(/* webpackChunkName: "reports" */ '../components/reports/Reports.vue')
      }
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
